package com.epoint.mobileoa.tools;

import android.content.Context;
import android.graphics.Color;
import android.text.TextUtils;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.LinearLayout.LayoutParams;

/**
 * @author liyc
 * @time 2012-4-5 上午9:32:04
 * @annotation 
 */
public class ControlsHelp {
	public static ArrayAdapter<String> getSPAdapter(Context con) {
		ArrayAdapter<String> adapter = new ArrayAdapter<String>(con,
				android.R.layout.simple_spinner_item);
		adapter
		.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		return adapter;
	}

	public static boolean Check_EditText_Blank_Warning(EditText et,String msg){
		if(TextUtils.isEmpty(et.getText())){
			et.setError(msg);
			et.requestFocus();
			et.setText("");
			return true;
		}
		return false;
	}
	
	private static long lastClickTime;   
    public static boolean isFastDoubleClick() {   
        long time = System.currentTimeMillis();      
        if ( time - lastClickTime < 500) {      
            return true;      
        }
        lastClickTime = time;      
        return false;      
    }   

    public static TextView getLineTextView(Context con)
    {
    	TextView line = new TextView(con);
		line.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,
				1));
		line.setBackgroundColor(Color.BLACK);
		return line;
    }
}
